
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;


namespace Tama_Chan.ParticleEngine_ns
{
   public class ParticleEffectGroup : IParticleEffect
   {
      public bool IsDead { get; set; }
      private IList<IParticleEffect> ParticleEffects { get; set; }


      public ParticleEffectGroup(int numberOfEffects)
      {
         IsDead = false;
         ParticleEffects = new List<IParticleEffect>(numberOfEffects);   
      }

      public void AddParticleEffects(IParticleEffect particleEffect)
      {
         ParticleEffects.Add(particleEffect);
      }

      public void Update(GameTime gameTime)
      {
         for(int i=0; i<ParticleEffects.Count; i++)
         {
            ParticleEffects[i].Update(gameTime);
         }

         // If all are dead, this effect is dead
         IsDead = ParticleEffects.All(t => t.IsDead);
      }

      public void Draw()
      {
         for(int i = 0; i < ParticleEffects.Count; i++)
         {
            ParticleEffects[i].Draw();
         }
      }

   }
}
